c812a50e1ff8dcfaecbeb350439097d34564da9b,opennms-dao/src/main/java/org/opennms/netmgt/dao/castor/CastorUtils.java,CastorUtils,unmarshalWithTranslatedExceptions,#Class#Resource#,189

Before Change


    public static <T> T unmarshalWithTranslatedExceptions(Class<T> clazz, Resource resource) {
        Reader reader;
        try {
            reader = new InputStreamReader(resource.getInputStream());
        } catch (IOException e) {
            throw CASTOR_EXCEPTION_TRANSLATOR.translate("opening XML configuration file for resource '" + resource + "'", e);
        }

After Change


     *      the resource from its {@link Resource#toString() toString()} method.
     */
    public static <T> T unmarshalWithTranslatedExceptions(Class<T> clazz, Resource resource) {
        InputStream in;
        try {
            in = resource.getInputStream();
        } catch (IOException e) {
            throw CASTOR_EXCEPTION_TRANSLATOR.translate("opening XML configuration file for resource '" + resource + "'", e);
        }
    
        try {
            InputSource source = new InputSource(in);
            try {
                source.setSystemId(resource.getURL().toString());
            } catch (Throwable t) {
                // ignore
            }